#ifndef MYMQTT
#define MYMQTT

#include <Arduino.h>
#include <ArduinoJson.h>
#include <PubSubClient.h>

#include "WifiModule/MyWifi.h"

extern const int ledPin;
extern bool isBlinking;

extern String deviceName; // 声明全局变量
extern bool switch3HighLevel; // 声明全局变量

// MQTT 服务器信息
extern const char *mqtt_topic; //mac地址作为订阅的地址

extern PubSubClient mqClient;

extern boolean showMqStatus;

void connect_mqtt(const char *mqtt_user,const char *mqtt_password);

void initCpuSensor();

float getCpTtemperature();

String createJsonMessage(const char* status) ;

void blinkLED(int times, int interval);

void handlerOption(const String &jsonString);

void callback(char *topic, byte *payload, unsigned int length) ;

void setupMqtt(const char *mqtt_server,const int mqtt_port,const char *mqtt_user,const char *mqtt_password);

void sendHeartBeat();

String createPowerOnBackMessage() ;

void sendPowerOnBack();

#endif